home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / aros / source / exec / internal / m68k / m68k-native / disable.s < prev    next >
Encoding:
Text File  |  1996-07-16  |  2.1 KB  |  75 lines

  1. |*****************************************************************************
  2. |
  3. |   NAME
  4. |
  5. |    __AROS_LH0(void, Disable,
  6. |
  7. |   LOCATION
  8. |    struct ExecBase *, SysBase, 20, Exec)
  9. |
  10. |   FUNCTION
  11. |    This function disables the delivery of all interrupts until a matching
  12. |    call to Enable() is done. This implies a Forbid(). Since the system
  13. |    needs the regular delivery of all interrupts it's forbidden to disable
  14. |    them for longer than ~250 microseconds.
  15. |
  16. |    THIS CALL IS VERY DANGEROUS!!!
  17. |
  18. |    Do not use it without thinking very well about it or better don't use
  19. |    it at all. Most of the time you can live without it by using semaphores
  20. |    or similar.
  21. |
  22. |    Calls to Disable() nest, i.e. for each call to Disable() you need one
  23. |    call to Enable().
  24. |
  25. |   INPUTS
  26. |
  27. |   RESULT
  28. |
  29. |   NOTES
  30. |    This function preserves all registers.
  31. |
  32. |    This function may be used from interrupts to disable all higher
  33. |    priority interrupts. Lower priority interrupts are disabled anyway.
  34. |
  35. |    To prevent deadlocks calling Wait() in disabled state breaks the
  36. |    disable - thus interrupts and taskswitches may happen again.
  37. |
  38. |   EXAMPLE
  39. |
  40. |   BUGS
  41. |
  42. |   SEE ALSO
  43. |    Forbid(), Permit(), Enable(), Wait()
  44. |
  45. |   INTERNALS
  46. |    For old exec Disable() there exists an assembler macro replacement
  47. |    that is (of course) importable. Using a Disable() implementation
  48. |    equal to this macro would not only have some impact on Disable()
  49. |    itself but also on other functions (e.g. Signal()).
  50. |    Therefore I decided to drop support for this macro to a certain
  51. |    extend. The difference is only miniscule:
  52. |    If a task uses the assembler macro and activates some higher priority
  53. |    task he cannot expect this task to be awakened immediately at Enable()
  54. |    but only at the next context switch. But I don't think that this
  55. |    poses any problems.
  56. |
  57. |   HISTORY
  58. |
  59. |******************************************************************************
  60.  
  61.     IDNestCnt   =    0x126
  62.     INTENA        =    0xdff09a
  63.     INTEN        =    0x4000
  64.     SET        =    0x8000
  65.  
  66.     .globl    _Exec_Disable
  67. _Exec_Disable:
  68.     | disable interrupts
  69.     movew    #INTEN,INTENA
  70.  
  71.     | increment nesting count and return
  72.     addqb    #1,a6@(IDNestCnt)
  73.     rts
  74.  
  75.